package com.example.yingjiguanli_demo.utils;


import org.springframework.web.socket.CloseStatus;

public class GameConstants {

    // WebSocket消息相关的常量
    public static final String ACTION_MATCH = "match";
    public static final String ACTION_FINISH = "finish";
    public static final String ACTION_RESULT = "result";
    public static final String STATUS_WAITING = "waiting";
    public static final String STATUS_MATCHED = "matched";
    public static final String STATUS_MESSAGE_WAITING = "等待匹配中...";

    // 时间常量
    public static final long MATCH_TIMEOUT_MS = 60000L; // 匹配超时时间：60秒
    public static final long CLEANUP_INTERVAL_MS = 60000L; // 清理间隔：60秒

    // WebSocket会话关闭状态
    public static final CloseStatus BAD_DATA_STATUS = CloseStatus.BAD_DATA;
    public static final String INVALID_USER_ID_MSG = "无法解析用户ID，关闭会话";
    public static final String USER_DISCONNECTED_MSG = "用户断开连接，用户ID: {}，当前在线用户数: {}";

    // 错误处理和日志
    public static final String UNKNOWN_ACTION_TYPE_MSG = "未知的 action 类型: {}";
    public static final String MATCH_SUCCESS_LOG = "匹配成功，用户 {} 对战用户 {}";
    public static final String WAITING_LOG = "用户 {} 加入等待队列";

    // 用户匹配状态常量
    public static final boolean USER_MATCH_READY = true;
    public static final boolean USER_NOT_MATCH_READY = false;

    // 数据库记录常量
    public static final String MATCH_RESULT_LOG = "比赛结束，用户 {} 得分: {}，对手 {} 得分: {}，结果: {}";

    public static final String MATCH_RESULT_WIN = "胜利";
    public static final String MATCH_RESULT_LOSE = "失败";
    public static final String MATCH_RESULT_TIE = "平局";
}

